<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('统计报表')" />
</head>
<body class="gray-bg">
<div class="container-div">
	<div class="row">
		<div class="col-sm-12 search-collapse">
			<form id="role-form">
				<div class="select-list">
					<ul>
						<li class="select-time">
							<label>创建时间： </label>
							<input type="text" class="time-input" id="beginDate" placeholder="开始时间" name="beginDate"/>
							<span>-</span>
							<input type="text" class="time-input" id="endDate" placeholder="结束时间" name="endDate"/>
						</li>
						<li>
							<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
						</li>
					</ul>
				</div>
			</form>
		</div>

		<div class="col-sm-12 select-table table-striped">
			<table id="bootstrap-table1"></table>
		</div>


		<div class="col-sm-12 select-table table-striped">
			<table id="bootstrap-table2"></table>
		</div>
<!--<div class="col-sm-12 select-table table-striped">-->

	<!--<div id="w_list_print">-->
	<!--<table class="table" width="100%" targetType="navTab"  asc="asc" desc="desc" layoutH="136">-->
		<!--<thead>-->
			<!--<tr align="center">-->
			    <!--<th width="50" >序号</th>-->
			    <!--<th width="200">项目编号</th>-->
			    <!--<th width="200">项目名称</th>-->
			    <!--<th width="200">采购计划</th>-->
			    <!--<th width="200">采购单位</th>-->
				<!--<th width="200">商品名称</th>-->
				<!--<th width="200">技术参数</th>-->
				<!--<th width="200">商品个数</th>-->
				<!--<th width="200">计量单位</th>-->
				<!--<th width="200">单价(元)</th>-->
				<!--<th width="200">总价(元)</th>-->
				<!--<th width="200">日期</th>-->
			<!--</tr>-->
		<!--</thead>-->
		<!--<tbody>-->
			<!--<c:forEach var="listDetails" items="${pager.dataList}" varStatus="vs">-->
				<!--<tr align="center">-->
					<!--<td>${vs.index+1}</td>-->
					<!--<td><c:out value="${listDetails.projectNumber}"></c:out></td>-->
					<!--<td><c:out value="${listDetails.projectName}"></c:out></td>-->
					<!--<td><c:out value="${listDetails.title}"></c:out></td>-->
					<!--<td><c:out value="${listDetails.unitName}"></c:out></td>-->
					<!--<td><c:out value="${listDetails.goodsName}"></c:out></td>-->
					<!--<td><c:out value="${listDetails.parameters}"></c:out></td>-->
					<!--<td><c:out value="${listDetails.number}"></c:out></td>-->
					<!--<td><c:out value="${listDetails.unit}"></c:out></td>-->
					<!--<td><fmt:formatNumber value="${listDetails.price}" type ="currency" pattern="0.00"/></td>-->
					<!--<td><fmt:formatNumber value="${listDetails.sumPrice}" type ="currency" pattern="0.00"/></td>-->
					<!--<td><c:out value="${fn:substring(listDetails.createTime,0,11)}"></c:out></td>-->
				<!--</tr>-->
			<!--</c:forEach>-->
		<!--</tbody>-->
	<!--</table>-->
	<!--</div>-->
	<!---->
	<!--<div class="panelBar" >-->
		<!--<div class="pages">-->
			<!--<span>显示</span>-->
			<!--<select name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value})">-->
			<!---->
				<!--<option value="20" <c:if test="${pager.pageSize == 20}">selected=selected</c:if>>20</option>-->
				<!--<option value="50" <c:if test="${pager.pageSize == 50}">selected=selected</c:if>>50</option>-->
				<!--<option value="100" <c:if test="${pager.pageSize == 100}">selected=selected</c:if>>100</option>-->
				<!--<option value="200" <c:if test="${pager.pageSize == 200}">selected=selected</c:if>>200</option>-->
			<!--</select>-->
			<!--<span>条，共${pager.totalCount}条</span>-->
		<!--</div>-->
		<!---->
		<!--<div class="pagination" targetType="navTab" totalCount="${pager.totalCount}" numPerPage="${pager.pageSize}" pageNumShown="10" currentPage="${pager.currentPage}"></div>-->

	<!--</div>-->

	<!--<div id="w_list_print">-->
	<!--<table class="table" width="100%" targetType="navTab"  asc="asc" desc="desc" layoutH="116">-->
		<!--<thead>-->
			<!--<tr align="center">-->
			    <!--<th width="200">批次</th>-->
				<!--<th width="200">总金额(元)</th>-->
			<!--</tr>-->
		<!--</thead>-->
		<!--<tbody>-->
			<!--<c:forEach var="listCountAll" items="${listCountAll}" varStatus="vs">-->
				<!--<tr align="center">-->
					<!--<td><c:out value="${listCountAll.approveCount}"></c:out></td>-->
					<!--<td><fmt:formatNumber value="${listCountAll.sumPrice}" type ="currency" pattern="0.00"/></td>-->
				<!--</tr>-->
			<!--</c:forEach>-->
		<!--</tbody>-->
	<!--</table>-->
	<!--</div>-->
<!--</div>-->

	</div>
</div>



<div th:include="include :: footer"></div>
<script th:inline="javascript">
	var prefix = ctx + "demo/operate";
	var listDetails = [[${listDetails}]];
	var listCountAll = [[${listCountAll}]];
	$(function() {
		var options = {
			id: "bootstrap-table1",
			toolbar: "toolbar1",
			// url: prefix + "/list",
			// createUrl: prefix + "/add",
			// removeUrl: prefix + "/remove",
			// updateUrl: prefix + "/edit/{id}",
			data:listDetails,
			modalName: "详细信息",
			columns: [{
				checkbox: true
			},
				{
					field : 'projectNumber',
					title : '项目编号'
				},
				{
					field : 'projectName',
					title : '项目名称'
				},
				{
					field : 'title',
					title : '采购计划'
				},
				{
					field : 'unitName',
					title : '采购单位'
				},
				{
					field : 'goodsName',
					title : '商品名称'
				},
				{
					field : 'parameters',
					title : '技术参数'
				},
				{
					field : 'number',
					title : '商品个数'
				},
				{
					field : 'price',
					title : '单价(元)',
					formatter: function(value, row, index) {
						return number_format(value, 2, ".", ",");
					}
				},
				{
					field : 'sumPrice',
					title : '总价(元)',
					formatter: function(value, row, index) {
						return number_format(value, 2, ".", ",");
					}
				},
				{
					field: 'createTime',
					title: '日期',
					formatter: function(value, row, index) {
						return value.substring(0,11);
					}
				},
				{
					title: '操作',
					align: 'center',
					formatter: function(value, row, index) {
						var actions = [];
						actions.push('<a class="btn btn-success btn-xs" href="###" onclick="$.operate.edit(\'' + row.userId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
						actions.push('<a class="btn btn-danger btn-xs" href="###" onclick="$.operate.remove(\'' + row.userId + '\')"><i class="fa fa-remove"></i>删除</a>');
						return actions.join('');
					}
				}]
		};
		$.table.init(options);
	});


	$(function() {
		var options = {
			id: "bootstrap-table2",
			toolbar: "toolbar2",
			// url: prefix + "/list",
			// createUrl: prefix + "/add",
			// removeUrl: prefix + "/remove",
			// updateUrl: prefix + "/edit/{id}",
			data:listCountAll,
			modalName: "汇总",
			columns: [{
				checkbox: true
			},
				{
					field : 'approveCount',
					title : '批次'
				},
				{
					field : 'sumPrice',
					title : '总金额(元)',
					formatter: function(value, row, index) {
						return number_format(value, 2, ".", ",");
					}
				},
				]
		};
		$.table.init(options);
	});

	function options1() {
		var temp = "";
		var obj = table.config['bootstrap-table1'];
		for (var i in obj) {
			temp += i + ":" + obj[i] + "<br/>";
		}
		$.modal.alert(temp);
	}

	function options2() {
		var temp = "";
		var obj = table.config['bootstrap-table2'];
		for (var i in obj) {
			temp += i + ":" + obj[i] + "<br/>";
		}
		$.modal.alert(temp);
	}


	function number_format(number, decimals, dec_point, thousands_sep) {
	 /*
 3     * 参数说明：
 4     * number：要格式化的数字
 5     * decimals：保留几位小数
 6     * dec_point：小数点符号
 7     * thousands_sep：千分位符号
 8     * */
		number = (number + '').replace(/[^0-9+-Ee.]/g, '');
		var n = !isFinite(+number) ? 0 : +number,
		prec = !isFinite(+decimals) ? 0 : Math.abs(decimals),
		sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep,
		dec = (typeof dec_point === 'undefined') ? '.' : dec_point,
		s = '',
		toFixedFix = function (n, prec) {
			var k = Math.pow(10, prec);
			return '' + Math.ceil(n * k) / k;
		};

		s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.');
		var re = /(-?\d+)(\d{3})/;
		while (re.test(s[0])) {
			s[0] = s[0].replace(re, "$1" + sep + "$2");
		}

		if ((s[1] || '').length < prec) {
			s[1] = s[1] || '';
			s[1] += new Array(prec - s[1].length + 1).join('0');
		 }
		     return s.join(dec);
	}
</script>
</body>
</html>